package com.itheima.ui;

import com.itheima.dao.IAccountDao;
import com.itheima.service.IAccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 模拟一个表现层，用于调用业务层
 */

public class Client {

    /**
     * 获取spring的ioc核心容器，并根据id获取对象
     * @param args
     */
    public static void main(String[] args) {

        //1.获取核心容器对象
        ApplicationContext context = new ClassPathXmlApplicationContext("bean.xml");

        IAccountService accountService = (IAccountService) context.getBean("accountServiceImpl");
        //IAccountDao accountDao = context.getBean(IAccountDao.class);

        System.out.println(accountService);
        accountService.saveAccount();
        //System.out.println(accountDao);
    }
}
